-
Notifications
You must be signed in to change notification settings - Fork 274
Add support for containers of move only typed values to range. #3586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
unit/util/range.cpp
Outdated
REQUIRE(both_inputs[19].value == 10); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️ missing new line
unit/util/range.cpp
Outdated
input1.emplace_back(i); | ||
std::vector<move_onlyt> input2; | ||
for(int i = 1; i <= 10; ++i) | ||
input2.emplace_back(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️ input2 is not used in all the tests, consider moving it closer to the test actually using it (maybe in a second GIVEN)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the commit messages contain a little more info why these things are required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor bits left as noted by reviewers.
@@ -357,12 +357,11 @@ ranget<iteratort> make_range(iteratort begin, iteratort end) | |||
return ranget<iteratort>(begin, end); | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment on the commit message: s/in oder/in order/
0172f42
to
cdcd544
Compare
I have addressed the review comments. I have also added better move support and corresponding unit tests for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: cdcd544).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95016060
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
This is required in order to allow values in the constructed range to be moved from.
This adds support for moving from the values accessible through the result of `ranget.filter`.
This adds support for moving from the values accessible through the result of `ranget.concat`.
This allows mapping into move only types. This was not previously possible, because the copy constructor of `map_iteratort` copied the value pointed to by its unique pointer in its `current` field. This can also be considered to be more correct, because copying an iterator should be expected to yield two copies, which point to the same value, rather than two copies, which point to two separate values.
This adds support for moving from the values accessible through the result of `ranget.map`.
cdcd544
to
0b73746
Compare
I have rebased in order to re-check test-gen compatibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New changes look good and previous comments addressed - if possible I'd like to see two more tests for map
{ | ||
const std::vector<int> input{1, 2, 3, 4, 5}; | ||
|
||
THEN("The vector can be mapped into a range of move-only types") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it works - you should add a test that maps from a move only type to a regular type, and one that moves the same type through the map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test which "maps from a move only type to a regular type" already exists. As we discussed, you missed it when reviewing. The f
passed into map
can't move from its parameter, because the parameter has to be a const reference. I have expanded the doxygen to document the extent of the support for move-only types and its limitations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: 0b73746).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95095292
Also @romainbrenguier should definitely re-review the unique_ptr -> shared_ptr before merging. |
The new doxygen explains the extent and limitations of `ranget.map`'s support of move-only types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: bbc2016).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95102012
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change from unique to shared pointer looks good
Uh oh!
There was an error while loading. Please reload this page.